#!/usr/bin/env bash
DIR_NAME_01=test
rm -r -f ${DIR_NAME_01}
mkdir ${DIR_NAME_01}
cd ${DIR_NAME_01}
git init

cp -f ../../111.txt 111.txt
cp -f ../../222.txt 222.txt
cp -f ../../333.txt 333.txt

git add 111.txt
git add 222.txt
git add 333.txt

git commit -m "master：add 111.txt 222.txt 333.txt"

git branch AAA
git checkout AAA
cp -f ../../444.txt 444.txt
git add 444.txt
cp -f ../../111-modify-by-AAA.txt 111.txt
git add 111.txt
git commit -m "AAA：1）add 444.txt；2）modify 111.txt"

git checkout master
git branch BBB
git branch CCC

git checkout BBB
cp -f ../../555.txt 555.txt
git add 555.txt
cp -f ../../111-modify-by-BBB.txt 111.txt
git add 111.txt
git commit -m "BBB：1）add 555.txt；2）modify 111.txt"

git checkout CCC
cp -f ../../666.txt 666.txt
git add 666.txt
cp -f ../../111-modify-by-CCC.txt 111.txt
git add 111.txt
git commit -m "CCC：1）add 666.txt；2）modify 111.txt"

# AAA merge to master
git checkout master
git merge AAA
git add 111.txt
git commit -m "master：1）111.txt 222.txt 333.txt 555.txt；2）111.txt=1AAA1"
# master：111.txt 222.txt 333.txt 555.txt 
# master：111.txt=1AAA1

# master merge to BBB
git checkout BBB
git merge master # BBB：111.txt冲突！
cp -f ../../111-conflict-process-master-merge-to-BBB-.txt 111.txt  # BBB：解决111.txt冲突
git add 111.txt
git commit -m "BBB：1）111-conflict-process-master-merge-to-BBB-.txt"
# BBB：111.txt=
#111
#1BBB1
#1AAA1
#111

# BBB merge to master
git checkout master
git merge BBB
# master：没有可以commit的文件！
# master：111.txt=
#111
#1BBB1
#1AAA1
#111

# master merge to CCC
git checkout CCC
git merge master # CCC：111.txt冲突！
cp -f ../../111-conflict-process-master-merge-to-CCC-.txt 111.txt  # CCC：解决111.txt冲突
git add 111.txt
git commit -m "CCC：1）111-conflict-process-master-merge-to-CCC-.txt"
# CCC：111.txt=
#111
#1CCC1
#1BBB1
#1AAA1
#111

# CCC merge to master
git checkout master
git merge CCC
# master：没有可以commit的文件！
# master：111.txt=
#111
#1BBB1
#1AAA1
#111

